package mylab.io.store.mqtt.common;


public enum MqttQoS {
    //@formatter:off
    AT_MOST_ONCE        (0),
    AT_LEAST_ONCE       (1),
    EXACTLY_ONCE        (2),
    FAILURE             (0x80),
    //@formatter:on
    ;

    private final int value;

    MqttQoS(int value) {
        this.value = value;
    }

    public static MqttQoS valueOf(int value) {
        for (MqttQoS q : values()) {
            if (q.value == value) {
                return q;
            }
        }
        throw new IllegalArgumentException("invalid QoS: " + value);
    }

    public int value() {
        return value;
    }
}
